import Vue from 'vue'
import Spin from './Spin'
import Modal from './Modal'
import Toast from './Toast'

import Alert from './Alert'
import Upload from './Upload'
import Table from './Table'
import Paging from './Paging'
import Breadcrumbs from './Breadcrumbs'
import SideMenu from './SideMenu'
import Input from './Input'
import Radio from './Radio'
import Checkbox from './Checkbox'
import InputNumber from './InputNumber'
import Select from './Select'
import Button from './Button'
import DatePicker from './DatePicker'
import Banner from './Banner'
import AreaPicker from './AreaPicker'
import Header from './Header'
import Tab from './Tab'
import Panel from './Panel'
import Rate from './Rate'
import RichEditor from './RichEditor'
import Emoji from './Emoji'
import CountDownTime from './countDownTime'
import MangeTitle from './MangeTitle'

const components = {
  'alert': Alert,
  'upload': Upload,
  'table': Table,
  'paging': Paging,
  'breadcrumbs': Breadcrumbs,
  'side-menu': SideMenu,
  'input': Input,
  'label': Input.label,
  'form-group': Input.group,
  'form-validate': Input.validate,
  'radio': Radio,
  'checkbox': Checkbox,
  'checkbox-group': Checkbox.group,
  'checkbox-item': Checkbox.item,
  'select': Select,
  'datepicker': DatePicker,
  'banner': Banner,
  'input-number': InputNumber,
  'button': Button,
  'button-group': Button.ButtonGroup,
  'button-timer': Button.ButtonTimer,
  'areapicker': AreaPicker,
  'header': Header,
  'tab': Tab,
  'tab-item': Tab.item,
  'panel': Panel,
  'panel-wrap': Panel.wrap,
  'panel-title': Panel.title,
  'panel-normal': Panel.normal,
  'panel-fixed-wrap': Panel.fixedWrap,
  'panel-validate': Panel.validate,
  'rate': Rate,
  'rich-editor': RichEditor,
  'count-down-time': CountDownTime,
  'emoji': Emoji,
  'mange-title': MangeTitle
}

Vue.use({
  install: Vue => {
    Object.keys(components).forEach(key => {
      Vue.component(`w-${key}`, components[key])
    })

    Vue.prototype.$spin = window.$spin = Spin
    Vue.prototype.$modal = window.$modal = Modal
    Vue.prototype.$toast = window.$toast = Toast
  }
})
